<?php

namespace App\Models;

class Account extends Base
{
    // 隐藏字段
    protected $hidden = ['created_at', 'updated_at'];

    // 批量赋值
    protected $fillable = [];
    
    /**
     * IP（一对一关系）
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function ip() {
        return $this->belongsTo(Ip::class);
    }
    
    /**
     * 平台（多对多关系）
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function platforms() {
        return $this->belongsToMany(Platform::class)->using(AccountPlatform::class);
    }

    public function users() {
        return $this->hasMany(UserAccount::class);
    }
}
